package com.cxy.user.service;

import com.cxy.user.domain.entity.User;
import com.cxy.user.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class UserService {
    @Autowired
    private UserRepository repository;

    public User findById(Integer id){
        return this.repository.findById(id).orElseThrow(()->new IllegalArgumentException("用户不存在！"));

    }
}
